package org.rabbitmq.test8;

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import org.rabbitmq.utils.RabbitMqUtils;

public class Producer {
    public static final String NORMAL_EXCHANGE = "normal_exchange";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();
        //延迟消息，死信消息，设置TTl时间
        AMQP.BasicProperties properties =
                new AMQP.BasicProperties()
                        .builder().expiration("10000").build();
        for (int i = 0; i < 10; i++) {
            String message = "info" +i;
            channel.basicPublish(NORMAL_EXCHANGE,"zhangsan",null,message.getBytes());
            System.out.println("发送消息："+message);
        }
    }
}
